package com.tenebrous.jestic.entity.model.response;

/**
 * @Description:
 * @Project: jestic-server
 * @Package: com.tenebrous.jestic.entity.model.response
 * @Author: zhangya
 * @CreateTime: 2023-06-30  16:37
 * @Version: 1.0.0
 */
public class AbstractResponse<T> {

    private T response;

    private int code;

    private String message;

    public void build(T response, Integer code, String message) {
        this.response = response;
        this.code = code;
        this.message = message;
    }

    public void buildSuccess(T response, String message) {
        this.response = response;
        this.code = 200;
        this.message = message;
    }

    public void buildSuccess(T response, Integer code) {
        this.response = response;
        this.code = code;
        this.message = "Success";
    }

    public void buildSuccess(T response) {
        this.response = response;
        this.code = 200;
        this.message = "Success";
    }

    public void buildError(T response) {
        this.response = response;
        this.code = 500;
        this.message = "系统异常";
    }

    public void buildError(T response, Integer code) {
        this.response = response;
        this.code = code;
        this.message = "系统异常";
    }

    public void buildError(T response, String message) {
        this.response = response;
        this.code = 500;
        this.message = message;
    }
}
